import {createRouter, createWebHistory} from 'vue-router'
import HomeView from "@/views/admin/HomeView.vue";
import IndexView from "@/views/admin/IndexView.vue";
import AdminView from "@/views/admin/AdminView.vue";
import CategoryView from "@/views/admin/CategoryView.vue";
import GoodsView from "@/views/admin/GoodsView.vue";
import OrderView from "@/views/admin/OrderView.vue";
import UserView from "@/views/admin/UserView.vue";

const router = createRouter({
    history: createWebHistory(import.meta.env.BASE_URL),
    routes: [
        {
            path: '/home',
            name: 'home',
            component: HomeView,
            redirect: '/index',
            children: [
                {
                    path: '/index',
                    name: 'index',
                    component: IndexView
                }, {
                    path: '/admin',
                    name: 'admin',
                    component: AdminView
                }, {
                    path: '/category',
                    name: 'category',
                    component: CategoryView
                }, {
                    path: '/goods',
                    name: 'goods',
                    component: GoodsView
                }, {
                    path: '/order',
                    name: 'order',
                    component: OrderView
                }, {
                    path: '/user',
                    name: 'user',
                    component: UserView
                }
            ]
        }
        //   {
        //     path: '/about',
        //     name: 'about',
        //     // route level code-splitting
        //     // this generates a separate chunk (About.[hash].js) for this route
        //     // which is lazy-loaded when the route is visited.
        //     component: () => import('../views/AboutView.vue')
        //   }
    ]
})

export default router
